<template>
    <div class="check map-zoom" v-loading="loading"
         element-loading-text="拼命加载中"
         element-loading-spinner="el-icon-loading"
         element-loading-background="rgba(255, 255, 255, 0.6)"
    >
        <dialog-order-details :order-detail="orderDetailData"></dialog-order-details>
    </div>
</template>

<script>
    import DialogOrderDetails from '../../components/dialogModel/SeeOrderAddress.vue';
    export default {
        name: 'order-detail',
        props: {
            params: {
                type: Object,
                default: () => {
                    return {}
                }
            }
        },
        components: {
            DialogOrderDetails
        },
        data() {
            return {
                loading:false,
                // orderDetailApi: 'express/order/1',
                orderDetailData: {}
            }
        },
        created() {
            this.$emit('dialogTitle','订单详情');
            this.getOrderDetail();
        },
        computed: {
            dataRefreshEvents() {
                return this.$store.state.num;
            },
            id: function (value) {
                return this.params.id
            }
        },
        watch: {
            dataRefreshEvents: function () {
                this.getOrderDetail();
            }
        },
        methods: {
            getOrderDetail() {
                this.loading = true;
                this.$http.get('express/order/' + this.id)
                    .then((response) => {
                        this.loading = false;
                        this.orderDetailData = response.data.data;
                    })
                    .catch((error) => {
                        this.loading = false;
                        if(error.response.data.msg){
                            this.$message.error(error.response.data.msg);
                        }else{
                            this.$message.error('请求错误：'+error.response.status);
                        }
                    });
            }
        }
    }
</script>

<style scoped>

</style>
